# -*- mode: snippet -*-
# name: header_drr
# key: drr
# --
/********************************************************************************************************************************************************
程序名称（Program Name）：		`(file-name-base (buffer-file-name))`
程序目的（Program Purpose）：	创建数据审核报告清单
程序作者（Author(s)）：			Yuanchen.Xie
创建日期（Date）： 				`(format-time-string "%F")`
程序版本（Version）：          	`(nth 7 (split-string (file-name-directory (buffer-file-name)) "/"))`
修改历史（Revision History）： 	xxxxx
*********************************************************************************************************************************************************/

%include "`(let* ((projname (nth 2 (split-string (file-name-directory (expand-file-name (buffer-name))) "/")))
(autopath (concat "d:/project/" projname "/Auto")))
(concat autopath "/" (nth 2 (directory-files autopath))))`";

%include "`(let* ((projname (nth 2 (split-string (file-name-directory (expand-file-name (buffer-name))) "/")))
       (macropath (concat "d:/project/" projname "/Cdm/Macro/" (nth 5 (split-string (buffer-file-name) "/")))))
  (concat macropath "/" (nth 2 (directory-files macropath))))`";

proc printto log = "`(let* ((filenamedir (split-string (file-name-directory (buffer-file-name)) "/"))
(currentdir (downcase (nth 9 filenamedir)))
(status2 (downcase (substring (nth 5 filenamedir) 0 2))))
(concat "&" status2 "_drrlog" currentdir "./" (file-name-base (buffer-file-name)) ".log"))`" new ;
run;

proc delete data=_all_;
run;

/* Code: ************************************************************************/

${5:%mergedt(dt=${2:raw${3:1}${4:_der}.}${1:}, out=$1, status=`(downcase (substring (nth 5 (split-string (buffer-file-name) "/")) 0 2))`, meth=`(let* ((filedir (nth 9 (split-string (file-name-directory (buffer-file-name)) "/"))))
(if (string= filedir "")
(downcase "\"grp\"")
(concat "\"" (downcase (substring filedir 0 2)) "\"")))`);

data $1_1;
$0set $1;
run;

}${6:%export(dt=
, sort=scrnum
, rank=subscnum scrnum
, title=`(file-name-base (buffer-file-name))`
, status=`(downcase (substring (nth 5 (split-string (buffer-file-name) "/")) 0 2))`
, meth=`(let* ((filedir (nth 9 (split-string (file-name-directory (buffer-file-name)) "/"))))
(if (string= filedir "")
(downcase "")
(downcase (substring filedir 0 2))))`
, out=DRR_`(if (>= (string-to-number (nth 1 (split-string (buffer-name) " "))) 10)
(nth 1 (split-string (buffer-name) " "))
(concat "0" (nth 1 (split-string (buffer-name) " "))))`);}

proc printto log = log new;
run;
